<!-- @format -->

<template>
  <div class="ma-content-block" style="height: 100%; position: relative">
    <!-- CRUD 组件 -->

    <div class="flex flex_wrap" v-if="props.list.length != 0">
      <div
        class="zc_card pad12"
        v-for="(item, index) in props.list"
        :key="index"
        style="padding-bottom: 0"
      >
        <div class="flex justify_between align_center marbot12">
          <div>{{ item.order_no }}</div>
          <!-- <a-tag bordered :color="item.deriver_pick_status == 0 ?'gray':item.deriver_pick_status == 1 || item.deriver_pick_status == 2?'green':'gray'">
					{{item.deriver_pick_status == 0?'待装车':item.deriver_pick_status == 1?'待装车':item.deriver_pick_status == 2?'已装车':'已取消'}}
				</a-tag> -->
          <a-tag
            class="font28 hei"
            v-if="item.deriver_pick_status == 0"
            color="orange"
            >待装车</a-tag
          >
          <a-tag
            class="font28 hei"
            v-if="item.deriver_pick_status == 1"
            color="orange"
            >已装车</a-tag
          >
          <a-tag
            class="font28 hei"
            v-if="item.deriver_pick_status == 2"
            color="orange"
            >运输中</a-tag
          >
          <a-tag
            class="font28 hei"
            v-if="item.deriver_pick_status == 3"
            color="gray"
            >已取消</a-tag
          >
          <a-tag
            class="font28 hei"
            v-if="item.deriver_pick_status == 4"
            color="green"
            >已送达</a-tag
          >
          <a-tag
            class="font28 hei"
            v-if="item.deriver_pick_status == 5"
            color="green"
            >已签收</a-tag
          >
        </div>
        <div class="flex align_center marbot12">
          <div style="font-size: 16px; font-weight: 600; margin-right: 20px">
            {{ item.deriver_name }}
          </div>
          <div style="font-size: 16px; font-weight: 500">
            {{ item.deriver_car_no }}
          </div>
        </div>
        <div class="flex justify_between align_center marbot12">
          <div style="margin-right: 20px">{{ item.deriver_mobile }}</div>
          <div>{{ item.created_at }}</div>
        </div>
        <div class="flex justify_around align_center marbot12">
          <a-tag color="blue">{{
            item.transport_type == 1 ? "集装箱" :item.transport_type == 2 ? "整车" : "批量零散"
          }}</a-tag>
          <a-tag color="blue">{{
            item.buff_type == 1
              ? "对装"
              : item.buff_type == 2
              ? "非对装"
              : "未知"
          }}</a-tag>
          <a-tag color="blue">{{
            item.pick_type == 1
              ? "自提"
              : item.pick_type == 2
              ? "委托派送"
              : item.pick_type == 3
              ? "仓储自提"
              : "仓储委托派送"
          }}</a-tag>
        </div>
        <div
          class="marbot12"
          style="height: 1px; background: rgba(0, 0, 0, 0.15)"
        ></div>
        <div class="flex flex_wrap">
          <div
            class="butNt flex align_center cursor"
            @click="detailList(item)"
            v-if="item.deriver_pick_status != 3"
            v-auth="['prediction:deriverOrderDetail:index']"
          >
            装车明细
          </div>
          <a-popconfirm content="是否取消本条装车单?" @ok="detailcel(item)">
            <div
              class="butNt flex align_center cursor"
              v-if="
                item.deriver_pick_status != 4 && item.deriver_pick_status != 3
              "
              v-auth="['prediction:deriverOrder:cancelOrder']"
            >
              取消装车单
            </div>
          </a-popconfirm>

          <div
            class="butNt flex align_center cursor"
            @click="openPicListcmt(item)"
            v-if="item.deriver_pick_status != 3"
            v-auth="['prediction:printLog:getNo']"
          >
            打印出门条({{ item.pcount }})
          </div>
          <div
            class="butNt flex align_center cursor"
            @click="openPaiSong(item)"
            v-if="
              (item.pick_type == 2 || item.pick_type == 4) &&
              item.deriver_pick_status != 3
            "
            style="margin-right: 0"
          >
            打印派送单
          </div>
          <div
            class="butNt flex align_center cursor"
            @click="opentiHuo(item)"
            v-if="
              (item.pick_type == 1 || item.pick_type == 3) &&
              item.deriver_pick_status != 3
            "
            style="margin-right: 0"
          >
            打印装车单
          </div>
        </div>
      </div>
    </div>
    <div
      class="flex justify_center align_center"
      style="height: 100%; width: 100%"
      v-if="props.list.length == 0"
    >
      <a-empty />
    </div>
    <!-- 加载中... -->

    <a-drawer
      :footer="false"
      :width="1400"
      v-model:visible="visibleDeriverOrderDetail"
    >
      <template #title> 装车明细 </template>
      <deriverorderdetail ref="deriverOrderDetailRef" />
    </a-drawer>
    <a-drawer
      :footer="false"
      :width="1400"
      v-model:visible="visibleDeriverOrderDetail2"
    >
      <template #title> 装车明细 </template>
      <deriverorderdetail2 ref="deriverOrderDetailRef2" />
    </a-drawer>
    <!-- 打印出门条 - 普通类型、精准类型 -->
    <a-modal
      v-model:visible="showModle_cmt"
      width="auto"
      title="威斯腾物流园"
      ok-text="打印"
      :footer="false"
    >
      <div
        style="
          display: flex;
          width: 100%;
          padding: 0 36px;
          box-sizing: border-box;
        "
      >
        <div style="margin-right: 12px; flex: 1">
          <a-form-item label="发货人">
            <a-input v-model="fahuoname" placeholder="请输入发货人" />
          </a-form-item>
        </div>
        <div style="flex: 1">
          <a-form-item label="提货人">
            <a-input v-model="tihuoname" placeholder="请输入提货人" />
          </a-form-item>
        </div>
      </div>
      <div
        style="
          display: flex;
          width: 100%;
          padding: 0 36px;
          box-sizing: border-box;
        "
      >
        <div style="margin-right: 12px; flex: 1">
          <a-form-item label="提货单位">
            <a-input v-model="tihuodanwei" placeholder="请输入提货单位" />
          </a-form-item>
        </div>
        <div style="flex: 1">
          <a-form-item label="提货日期">
            <a-date-picker show-time format="YYYY-MM-DD HH:mm" @ok="onOk" />
          </a-form-item>
        </div>
      </div>

      <div
        style="width: 210mm; padding: 5mm 36px; box-sizing: border-box"
        id="crudContent_cmts"
      >
        <div
          style="
            display: flex;
            justify-content: center;
            margin-bottom: 10px;
            position: relative;
          "
        >
          <div>
            <div style="font-size: 14px; text-align: center">
              四川威斯腾物流有限公司
            </div>
            <div style="font-size: 24px; text-align: center">
              物 资 出 门 证
            </div>
          </div>
          <div
            style="
              position: absolute;
              right: 6px;
              top: 50%;
              transform: translateY(-50%);
            "
          >
            <div style="display: flex; align-items: center; font-size: 18px">
              <div style="font-weight: 600">NoA：</div>
              <div style="width: 80px; color: red">{{ no }}</div>
            </div>
            <div style="display: flex; align-items: center; font-size: 18px">
              <div style="font-weight: 400">车牌号：</div>
              <div style="width: 80px">
                <span style="font-size: 15px">{{ datas.deriver_car_no }}</span>
              </div>
            </div>
            <!-- <div style="display:flex;align-items: center;font-size:18px;">
              <div style="font-weight: 400;">订单号：</div>
              <div ><span style="font-size:15px;">{{ order_noe }}</span></div>
            </div> -->
          </div>
          <div style="position: absolute; left: 0px; top: 0">
            <div>
              <span style="font-size: 18px; color: red">{{ order_noe }}</span>
            </div>
          </div>
        </div>
        <div
          style="
            margin-bottom: 10px;
            display: flex;
            justify-content: space-between;
          "
        >
          <div>提货单位：{{ tihuodanwei }}</div>
          <div>装车时间：{{ zhuangcheTime }}</div>
          <div>打印时间：{{ tihuoTime }}</div>
        </div>
        <div style="display: flex; width: 100%; flex-direction: column">
          <div style="flex: 1; margin-bottom: 10px">
            <div style="" class="table">
              <table
                style="width: 100%"
                v-if="
                  props.inforow?.pick_type == 1 || props.inforow?.pick_type == 2
                "
              >
                <tr style="display: flex">
                  <td
                    style="
                      flex: 1;
                      display: flex;
                      justify-content: center;
                      align-items: center;
                      height: 32px;
                    "
                  >
                    <div>车号</div>
                  </td>
                  <td
                    style="
                      flex: 1;
                      display: flex;
                      justify-content: center;
                      align-items: center;
                      height: 32px;
                    "
                  >
                    <div>物资名称</div>
                  </td>

                  <td
                    style="
                      flex: 1;
                      display: flex;
                      justify-content: center;
                      align-items: center;
                      height: 32px;
                    "
                  >
                    <div>件数</div>
                  </td>
                  <td
                    style="
                      flex: 1;
                      display: flex;
                      justify-content: center;
                      align-items: center;
                      height: 32px;
                    "
                  >
                    <div>重量</div>
                  </td>
                  <td
                    style="
                      width: calc((100% / 9));
                      display: flex;
                      justify-content: center;
                      align-items: center;
                      height: 32px;
                    "
                  >
                    <div>备注</div>
                  </td>
                </tr>
                <tr
                  v-for="(item, index) in datas.detail"
                  :key="index"
                  style="display: flex"
                >
                  <!-- <td style="flex:1;display:flex;justify-content: center;align-items: center;min-height:53px"><div>{{ item.order_no }}</div></td> -->
                  <td
                    style="
                      flex: 1;
                      display: flex;
                      justify-content: center;
                      align-items: center;
                      min-height: 32px;
                    "
                  >
                    <div>{{ item.prediction.car_no }}</div>
                  </td>
                  <td
                    style="
                      flex: 1;
                      display: flex;
                      justify-content: center;
                      align-items: center;
                      min-height: 32px;
                    "
                  >
                    <div>{{ item.prediction.goods_name }}</div>
                  </td>

                  <td
                    style="
                      flex: 1;
                      display: flex;
                      justify-content: center;
                      align-items: center;
                      min-height: 32px;
                    "
                  >
                    <div>{{ item.pick_number }}</div>
                  </td>
                  <td
                    style="
                      flex: 1;
                      display: flex;
                      justify-content: center;
                      align-items: center;
                      min-height: 32px;
                    "
                  >
                    <div>{{ (item.pick_weight - 0).toFixed(3) }}</div>
                  </td>
                  <td
                    style="
                      width: calc((100% / 9));
                      display: flex;
                      justify-content: center;
                      align-items: center;
                      min-height: 32px;
                    "
                  >
                    <!-- <div>{{ item.prediction.remark }}</div> -->
                  </td>

                  <!-- <td v-if="item.prediction.transport_type == 2"  style="flex:1;display:flex;justify-content: center;align-items: center;"><div>{{ item.pick_weight }}</div></td> -->
                </tr>
              </table>
              <table
                style="width: 100%"
                v-if="
                  props.inforow?.pick_type == 3 || props.inforow?.pick_type == 4
                "
              >
                <tr style="display: flex">
                  <td
                    style="
                      flex: 1;
                      display: flex;
                      justify-content: center;
                      align-items: center;
                      height: 32px;
                    "
                  >
                    <div>车号</div>
                  </td>
                  <td
                    style="
                      flex: 1;
                      display: flex;
                      justify-content: center;
                      align-items: center;
                      height: 32px;
                    "
                  >
                    <div>物资名称</div>
                  </td>

                  <td
                    style="
                      flex: 1;
                      display: flex;
                      justify-content: center;
                      align-items: center;
                      height: 32px;
                    "
                  >
                    <div>仓库</div>
                  </td>
                  <td
                    style="
                      flex: 1;
                      display: flex;
                      justify-content: center;
                      align-items: center;
                      height: 32px;
                    "
                  >
                    <div>产地</div>
                  </td>
                  <td
                    style="
                      flex: 1;
                      display: flex;
                      justify-content: center;
                      align-items: center;
                      height: 32px;
                    "
                  >
                    <div>件数</div>
                  </td>
                  <td
                    style="
                      flex: 1;
                      display: flex;
                      justify-content: center;
                      align-items: center;
                      height: 32px;
                    "
                  >
                    <div>重量</div>
                  </td>
                </tr>
                <tr
                  v-for="(item, index) in datas.detail"
                  :key="index"
                  style="display: flex"
                >
                  <td
                    style="
                      flex: 1;
                      display: flex;
                      justify-content: center;
                      align-items: center;
                      min-height: 32px;
                    "
                  >
                    <div>{{ item.wareuserdetail.car_no }}</div>
                  </td>
                  <td
                    style="
                      flex: 1;
                      display: flex;
                      justify-content: center;
                      align-items: center;
                      min-height: 32px;
                    "
                  >
                    <div>{{ item.wareuserdetail.goods_name }}</div>
                  </td>

                  <td
                    style="
                      flex: 1;
                      display: flex;
                      justify-content: center;
                      align-items: center;
                      min-height: 32px;
                    "
                  >
                    <div>
                      {{
                        item.wareuserdetail.warehouse_log_chu?.warehouse.name
                      }}/{{
                        item.wareuserdetail.warehouse_log_chu
                          ?.horizontal_position
                      }}-{{
                        item.wareuserdetail.warehouse_log_chu?.release_position
                      }}-{{
                        item.wareuserdetail.warehouse_log_chu?.reaches_position
                      }}
                    </div>
                  </td>
                  <td
                    style="
                      flex: 1;
                      display: flex;
                      justify-content: center;
                      align-items: center;
                      min-height: 32px;
                    "
                  >
                    <div>{{ item.wareuserdetail.producer }}</div>
                  </td>
                  <td
                    style="
                      flex: 1;
                      display: flex;
                      justify-content: center;
                      align-items: center;
                      min-height: 32px;
                    "
                  >
                    <div>{{ item.pick_number }}</div>
                  </td>
                  <td
                    style="
                      flex: 1;
                      display: flex;
                      justify-content: center;
                      align-items: center;
                      min-height: 32px;
                    "
                  >
                    <div>{{ (item.pick_weight - 0).toFixed(3) }}</div>
                  </td>
                </tr>
              </table>
            </div>
          </div>

          <div
            style="
              display: flex;
              align-items: center;
              line-height: 14px;
              margin-bottom: 10px;
              justify-content: center;
            "
          >
            <div>①</div>
            <div>（</div>
            <div>白</div>
            <div>）</div>
            <div>威</div>
            <div>斯</div>
            <div>腾</div>
            <div>留</div>
            <div>底</div>
            <div style="width: 4px"></div>
            <div>②</div>
            <div>（</div>
            <div>红</div>
            <div>）</div>
            <div>随</div>
            <div>车</div>
            <div>留</div>
            <div>存</div>
            <div style="width: 4px"></div>
            <div>③</div>
            <div>（</div>
            <div>黄</div>
            <div>）</div>
            <div>门</div>
            <div>卫</div>
            <div>留</div>
            <div>底</div>
          </div>
        </div>

        <div style="display: flex; margin-bottom: 10px">
          <div style="flex: 1">发货人：{{ fahuoname }}</div>
          <div style="flex: 1">提货人：{{ tihuoname }}</div>
          <div style="flex: 1">制单人：{{ user.nickname }}</div>
          <div>复打次数：{{ pcount }}</div>
        </div>
        <!-- <div style="text-align: center;">(第一联留存联，第二联客户联，第三联提货联)</div> -->
      </div>

      <div
        style="display: flex; margin-bottom: 10px"
        v-if="old_no != '0000000'"
      >
        <div style="width: 100px">作废原因：</div>
        <a-textarea
          placeholder="请输入作废原因"
          @focus="handleFocus"
          v-model="remark"
          allow-clear
          :error="errFalg"
        />
      </div>
      <div style="display: flex; justify-content: flex-end">
        <div v-if="old_no != '0000000'">
          <a-button v-print="printObjcmt" type="primary" v-if="remark"
            >打印</a-button
          >
          <a-button type="primary" v-if="!remark" @click="handlePrint"
            >打印</a-button
          >
        </div>
        <div v-if="old_no == '0000000'">
          <a-button v-print="printObjcmt" type="primary">打印</a-button>
        </div>
      </div>
    </a-modal>
    <!-- 打印出门条 - 集装箱类型 -->
    <a-modal
      v-model:visible="showModle_cmtjzx"
      width="auto"
      title="威斯腾物流园"
      ok-text="打印"
      :footer="false"
    >
      <cmtjzx
        :row="rowData"
        :no="no"
        :remark="jzxPop.remark"
        :errFalg="jzxPop.errFalg"
        :old_no="old_no"
        :tihuoTime="tihuoTime"
        @bianhua="handleBian"
        @gengxin="handleEmit"
      ></cmtjzx>
    </a-modal>

    <!-- 打印派送单 -->
    <a-modal
      v-model:visible="paiSongShow"
      width="auto"
      title="打印派送单"
      ok-text="打印"
      :footer="false"
    >
      <paisong :row="paiSongList" :user="user" v-if="paiSongShow"></paisong>
    </a-modal>
    <!-- 打印装车单 -->
    <a-modal
      v-model:visible="tiHuoShow"
      width="auto"
      title="打印装车单"
      ok-text="打印"
      :footer="false"
    >
      <tihuo :row="tiHuoList" :user="user" v-if="tiHuoShow"></tihuo>
    </a-modal>
  </div>
</template>
<script setup>
import { ref, reactive, defineProps, defineEmits } from "vue";
import predictionDeriverOrder from "@/api/prediction/predictionDeriverOrder";
import { Message } from "@arco-design/web-vue";
import tool from "@/utils/tool";
import { useUserStore } from "@/store";

import * as common from "@/utils/common";
import deriverorderdetail from "@/views/prediction/deriverOrderDetail/indexJzx.vue";
import deriverorderdetail2 from "@/views/prediction/deriverOrderDetail/index.vue";
import cmtjzx from "./cmt_jzx.vue";
import paisong from "@/components/paisong/index.vue";
import tihuo from "@/components/tihuo/index.vue";
const emit = defineEmits(["shuaxin"]);
const props = defineProps({
  list: {
    type: Array,
    default: []
  },
  inforow: {
    type: Object,
    default: {}
  },
  loading: {
    type: Boolean,
    default: false
  }
});
const crudRef = ref();
const order_id = ref();
const no = ref();
const tihuoname = ref();
const fahuoname = ref();
const tihuoTime = ref();
const zhuangcheTime = ref();
const tihuodanwei = ref();
const pcount = ref();
const visibleDeriverOrderDetail = ref();
const visibleDeriverOrderDetail2 = ref();
const deriverOrderDetailRef = ref();
const deriverOrderDetailRef2 = ref();
const showModle = ref(false);
const showModle_cmt = ref(false);
const showModle_cmtjzx = ref(false);
const userStore = useUserStore();
const order_noe = ref();
const rowData = ref({});
// 当前登录的用户所有信息，包括 id 用户名 昵称 等信息
const user = userStore.user;
let newData = "";
let datas = [];
const old_no = ref();
const remark = ref();
const errFalg = ref(false);
const jzxPop = ref({});
const crudContent = ref();
const paiSongList = ref([]);
const paiSongShow = ref(false);
const tiHuoList = ref([]);
const tiHuoShow = ref(false);

jzxPop.value = {
  errFalg: false,
  remark: ""
};
const printObj = {
  id: "crudContents",
  popTitle: "页面打印"
};
const printObjcmt = {
  id: "crudContent_cmts",
  popTitle: "页面打印",
  openCallback(vue) {
    showModle_cmt.value = false;
    predictionDeriverOrder
      .getprintSave({ type: 2, link_id: datas.id, remark: remark.value })
      .then((res) => {
        crudRef.value.refresh();
      });
  }
};
const openPaiSong = (item) => {
  // 打印派送单
  item.detail.map((v, i) => {
    if (v.prediction_id == 0) {
      v.prediction = v.wareuserdetail;
    }
    if(v.prediction.goods_data != null){
				if(Array.isArray(v.prediction.goods_data)){

				}else{
					v.prediction.goods_data = [JSON.parse(JSON.stringify(v.prediction.goods_data))]
				}
			}else{
				v.prediction.goods_data = []
			}
  })
  paiSongList.value = item;
  paiSongShow.value = true;
};
const opentiHuo = (item) => {
  // 打印提货单
  item.detail.map((v, i) => {
    if (v.prediction_id == 0) {
      v.prediction = v.wareuserdetail;
    }
  });
  tiHuoList.value = item;
  tiHuoShow.value = true;
};
const handleBian = (obj) => {
  jzxPop.value.errFalg = obj.errFalg;
  jzxPop.value.remark = obj.remark;
};
const handleEmit = () => {
  crudRef.value.refresh();
};
const handleFocus = () => {
  errFalg.value = false;
};
const handlePrint = () => {
  if (!remark.value) {
    Message.error("请输入作废原因");
    errFalg.value = true;
  }
};
const detailcel = (row) => {
  // 取消
  predictionDeriverOrder.getcancelOrder({ id: row.id }).then((res) => {
    if (res.code == 200) {
      Message.success("取消成功！");
      emit("shuaxin");
    }
  });
};
const detailList = (row) => {
  if (props.inforow.pick_type == 1 || props.inforow.pick_type == 2) {
    if (props.inforow.transport_type == 1) {
      let is_taoxiang = 0;
      row.detail.map((v, i) => {
        is_taoxiang = v.prediction.box.is_taoxiang;
      });
      row.is_taoxiang = is_taoxiang;
      visibleDeriverOrderDetail.value = true;
      deriverOrderDetailRef.value.open(row, props.inforow);
    } else {
      visibleDeriverOrderDetail2.value = true;
      deriverOrderDetailRef2.value.open(row, props.inforow);
    }
  }
  if (props.inforow.pick_type == 3 || props.inforow.pick_type == 4) {
    if (props.inforow.transport_type == 2) {
      visibleDeriverOrderDetail2.value = true;
      deriverOrderDetailRef2.value.open(row, props.inforow);
    } else if (props.inforow.transport_type == 1) {
      let is_taoxiang = 0;
      row.detail.map((v, i) => {
        is_taoxiang = v.wareuserdetail.box.is_taoxiang;
      });
      row.is_taoxiang = is_taoxiang;
      visibleDeriverOrderDetail.value = true;
      deriverOrderDetailRef.value.open(row, props.inforow);
    }
  }
};
const onOk = (dateString, date) => {
  tihuoTime.value = dateString;
};
const openPicList = (row) => {
  newData = tool.dateFormat(
    Math.round(new Date().getTime() / 1000).toString(),
    "yyyy-MM-dd hh:mm:ss"
  );
  datas = row;
  showModle.value = true;

  // })
};
const openPicListcmt = (row) => {
  // if(row.deriver_pay_status == 0){
  // 	return Message.error('该账单还未支付')
  // }
  let arr = [];
  let number = 0;
  let weight = 0;
  let obj = JSON.parse(JSON.stringify(row));
  obj.detail.map((v, i) => {
    v.order_no = obj.order_no;
    number += obj.detail[i].pick_number - 0;
    weight += obj.detail[i].pick_weight - 0;
  });
  number = number;
  weight = weight.toFixed(3);
  if (props.inforow.pick_type == 1 || props.inforow.pick_type == 2) {
    obj.detail.push({
      prediction: {
        car_no: "合计",
        goods_name: "",
        remark: "",
        box: "",
        box_type: ""
      },
      pick_number: number,
      pick_weight: weight
    });
  } else if (props.inforow.pick_type == 3 || props.inforow.pick_type == 4) {
    obj.detail.push({
      wareuserdetail: {
        car_no: "合计",
        goods_name: "",
        box: "",
        box_type: "",
        warehouse: { name: "" },
        horizontal_position: "",
        release_position: "",
        reaches_position: ""
      },
      pick_number: number,
      pick_weight: weight
    });
  }

  datas = obj;
  predictionDeriverOrder
    .getGerNo({
      driver_order_id: obj.id
    })
    .then((res) => {
      no.value = res.data.no;
      old_no.value = res.data.old_no;
      fahuoname.value = row.create_user?.nickname;
      tihuoname.value = row.deriver_name;
      tihuodanwei.value = row.dept.name;
      pcount.value = row.pcount;
      tihuoTime.value = tool.dateFormat(
        Math.round(new Date().getTime() / 1000).toString(),
        "yyyy-MM-dd hh:mm:ss"
      );
      zhuangcheTime.value = row.created_at;
      if (datas.porder.transport_type == 1) {
        let boxArr = [];
        let box_typeArr = [];
        let taoxiang = 0;
        let ticket_number = "";
        row.detail.map((v, i) => {
          if (v.prediction_id != 0) {
            boxArr.push(v.prediction.box.box);
            taoxiang = v.prediction.box.is_taoxiang;
            box_typeArr.push(v.prediction.box_type);
            ticket_number = v.prediction.ticket_number;
          } else {
            boxArr.push(v.wareuserdetail.box.box);
            taoxiang = v.wareuserdetail.box.is_taoxiang;
            box_typeArr.push(v.wareuserdetail.box_type);
            ticket_number = v.wareuserdetail.ticket_number;
          }
        });
        row.boxs = boxArr.join(",");
        row.box_types = box_typeArr.join(",");
        row.ticket_number = ticket_number;
        rowData.value = row;
        if (taoxiang == 0) {
          showModle_cmtjzx.value = true;
        } else {
          showModle_cmt.value = true;
          remark.value = "";
        }
      } else {
        showModle_cmt.value = true;
        remark.value = "";
      }
    });
};

// 暴露方法
const open = (row) => {
  order_id.value = row.id;
  inforow.value = row;
  order_noe.value = row.order_no;
  crudRef.value.crudSearchRef.resetSearch();
  crudRef.value.requestData();
};

const numberOperation = (newValue, id, numberName) => {
  predictionDeriverOrder
    .numberOperation({ id, numberName, numberValue: newValue })
    .then((res) => {
      res.success && Message.success(res.message);
    })
    .catch((e) => {
      console.log(e);
    });
};

const switchStatus = (statusValue, id, statusName) => {
  predictionDeriverOrder
    .changeStatus({ id, statusName, statusValue })
    .then((res) => {
      res.success && Message.success(res.message);
    })
    .catch((e) => {
      console.log(e);
    });
};
defineExpose({ open });
</script>
<style lang="less" scoped>
.table,
th,
tr,
td {
  padding: 0px;
  box-sizing: border-box;
  text-align: center;
  font-size: 14px;
  line-height: 20px;
}

.table {
  border-top: 1px solid rgba(0, 0, 0);
  border-left: 1px solid rgba(0, 0, 0);
  width: 100%;
}

.table td {
  padding: 6px 10px;
  word-break: break-all;
  word-wrap: break-word;
}

.table tr td {
  border-right: 1px solid rgba(0, 0, 0);
  border-bottom: 1px solid rgba(0, 0, 0);
}

/* .table tr td:last-child{
  border-right: none;
}
.table tr:last-child td{
  border-bottom: none;
} */
.activetabs {
  border-radius: 10px 10px 0 0;
  background: rgba(242, 243, 255, 1);
  border-bottom: 4px solid rgba(31, 108, 235, 1);
}
.flex {
  display: flex;
}
.flex_wrap {
  flex-wrap: wrap;
}

.justify_between {
  justify-content: space-between;
}
.justify_around {
  justify-content: space-around;
}
.justify_center {
  justify-content: center;
}
.align_center {
  align-items: center;
}
.flex_column {
  flex-direction: column;
}
.flex_1 {
  flex: 1;
}
.width0 {
  width: 0;
}
.ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.marbot14 {
  margin-bottom: 14px;
}
.marbot12 {
  margin-bottom: 12px;
}
.pad12 {
  padding: 12px;
}
.zc_card {
  width: calc((100% - 12px) / 2);
  border-radius: 6px;
  border: 1px solid rgba(220, 220, 220, 1);
  margin-bottom: 12px;
  margin-right: 12px;
  &:nth-child(2n) {
    margin-right: 0;
  }
  .butNt {
    padding: 2px 8px;
    border-radius: 3px;
    border: 1px solid rgba(220, 220, 220, 1);
    margin-right: 12px;
    margin-bottom: 12px;
  }
}
.cursor {
  cursor: pointer;
}
</style>
<script>
export default { name: "prediction:deriverOrder" };
</script>
